import { useThemeStore } from "@/store/useThemeStore"
import { useWatermarkStore } from "@/store/useWatermarkStore"
import { useWatermark } from "@/hooks/useWatermark"
import { useCryptoStore } from "@/store/useCryptoStore"
import icon from "@/assets/vue.svg"
//@1 水印配置  ajax
setTimeout(() => {
  const { watermark } = useWatermark()
  // watermark.set()
  useWatermarkStore().setWatermarkStatus(false)
}, 1000 * 2)

// @2 ajax 主题配置
setTimeout(() => {
  const theme = "red"
  document.documentElement.classList = useThemeStore().themeConfig[theme]
  useThemeStore().themeConfig.current = `${theme}-theme`
})

// @3 slide左侧菜单配置
setTimeout(() => {
  const data = {
    slide_menu_bg: "#ee1e07",

    //字体和图标颜色
    slide_menu_font_icon_color: "#dbe6d2",

    //菜单被选中颜色
    slide_menu_selected_bg: "#114af9",
    // 菜单被选中图标颜色
    slide_menu_font_icon_selected_color: "#1cdbd0",
  }
  const root = document.querySelector(":root") as HTMLElement
  root.style.setProperty("--slide-menu-bg", data?.slide_menu_bg)
  root.style.setProperty("--slide-menu-font-icon-color", data?.slide_menu_font_icon_color)
  root.style.setProperty("--slide-menu-selected-bg", data?.slide_menu_selected_bg)
  root.style.setProperty("--slide-menu-font-icon-selected-color", data?.slide_menu_font_icon_selected_color)
  const slideMenuConfig = useThemeStore().slideMenuConfig
  if (data && Object.keys(data)) {
    Object.keys(data).forEach(v => {
      slideMenuConfig[v] = data[v]
    })
  }
}, 1)

// @4 获取crypto加密 密码
setTimeout(() => {
  const data = {
    iv: "ABCDEF1234123412",
  }
  useCryptoStore().publicKey = data.publishKey
  useCryptoStore().iv = data.iv
})

// @5 获取jsencrypt 加密密钥
setTimeout(() => {
  const data = {
    publishKey: `MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8U++0rifPWu9J8Jy3OYf
        eW9vg1k5qwA+lRwbumOrVaGsdLJt1mP+vtVb7hUr7xuo78SBAlyTzN5rpsTfp4mp
        Q6kN4YHOVvZKL+DLwv9nPve4fNf29jAy/ybf64AiMIrwBRsTLgY9uUb0hX6HmVJv
        XVB2Wai6r8JB9ESPkeubb9hqpkXxOKfQCMF6cDmeNouoVKE8PVdxAhX9D3Rkl3FR
        xbmsZ9oZ0wxELgj8V6mzDK02jRg/8rgSavoUGH4QDRHhIBJEPCXjFDACPzQH31ax
        92+TDfy0kPNe1kCVd//MnS22re6gvJLUqH6UMECx6RJinnLQuCwLAa4AvtajUOVr
        4QIDAQAB`,
    privateKey: `MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDxT77SuJ89a70n
        wnLc5h95b2+DWTmrAD6VHBu6Y6tVoax0sm3WY/6+1VvuFSvvG6jvxIECXJPM3mum
        xN+nialDqQ3hgc5W9kov4MvC/2c+97h81/b2MDL/Jt/rgCIwivAFGxMuBj25RvSF
        foeZUm9dUHZZqLqvwkH0RI+R65tv2GqmRfE4p9AIwXpwOZ42i6hUoTw9V3ECFf0P
        dGSXcVHFuaxn2hnTDEQuCPxXqbMMrTaNGD/yuBJq+hQYfhANEeEgEkQ8JeMUMAI/
        NAffVrH3b5MN/LSQ817WQJV3/8ydLbat7qC8ktSofpQwQLHpEmKectC4LAsBrgC+
        1qNQ5WvhAgMBAAECggEAJRucPo9BfZJ5zglq3GlO4b+vKEWqRo+NECT4Zps5F7v6
        5x8hINzTqcjpkB0VWnmoauaO6CwQVmrFpymTMxJKQytWBR2O+3R4SBCLhPr9h4NU
        jW4wff8/eFkkCfT0TP6wljhppKQ1Da7Jn1WryHoSwgjDiloWCz0WI1f/s/LFPld+
        6swQzkcXulcDS3bB4imRJwn1K2VNXfljAvZ+RmrUZfakPp+u2GVW2uSMGuCUhuRC
        pvRfhTMoIR4EelpNf1PDTW5YOd9NZ2B2M4Gt2UN3ogSWSmbXI4+FxiBXOxdgWAcW
        dnlsY0W68BeUjQ+ocCtAccFCdjRyrEN/X5kVDPljoQKBgQD87Qq+MrFlcjH+EaYD
        PKbi4ocGXsfur1JNrk3hDadIZBG1DH4OTV1ISMmmg8SNPjRRJUvfI15PRyUsofvI
        T93pSUMA/j9Hv0/YQg00eHlgfOEg70vbCdXY7TawXsT0r4+ieOVVnf+/e+OSwzjQ
        xtEotVDuNlw4fz/DgwyiqwWPvQKBgQD0PpDqUH6E+Dy8XrpImZVu6VyBBkbxJQWa
        cIF4y6dRJaFoQuy/XYs8txT9i6KCIV0rOs+eFxF8UAb0w5vwnr1TTmka5eu0nVM+
        xLY11eNXVZDTYkgnp1vgTI9sZz+8J1hQHati4L5PtGQFBESnRdNFd+X7UBpHPQdE
        7YotM44M9QKBgD+3f6NWpfYGhK2ayJW8K9awdo+WRQvOQw+qv5fYlrHX89YGZaM4
        vi09mP9H5rYmW4utt6VpBZM3Oxg5XnKiHCdu+2A+rLZobbbvPOBhEULLcvOXFScD
        HUpeyA46caeqqqalijC9cvZMQZJxd9iwnXSB6Pd53lWlSOz6EK7SIr6JAoGAVK1Q
        TnwDsRPi8qegy8S7Yw1yraTAeaANNkLlED0C0AZM1DnHnHzQ5gbPNyvu9lCc3Xzx
        N+zlegTAtKEQcjaGitg3ZkTqF98nWi6WwUlbHQ8kO7TqMR07pCLG4p1VImU9n+D5
        ZzlloXp35qlZJ+j0WzQ7PorB4YrN916nNg6Wo/UCgYBH7r2YI/+/h5M93LvbmJPp
        zgVS98X23BzkGc9G3Cgk9PJypxW/fJ11F0RU/Wh8e+yztYC15CeZRkSztGu/+OXl
        2GsrGT9SaYU8uivxk39I3LygyCImbPeKz7IFJZOfGCwDcX23uxOM4xpZFeLlnQhi
        Hn7dYcccDNtJC+ASldGL1w==`,
  }
  useCryptoStore().publicKey = data.publishKey
  useCryptoStore().iv = data.iv
})

// @6 网站动态换icon
setTimeout(() => {
  const link: any = document.querySelector("link[rel*='icon']")
  link.href = icon
}, 1000 * 2)
